<?php

/**
 * Referee filter form base class.
 *
 * @package    makethetouch
 * @subpackage filter
 * @author     Sebastien Chassande-Barrioz
 * @version    SVN: $Id: sfDoctrineFormFilterGeneratedTemplate.php 29570 2010-05-21 14:49:47Z Kris.Wallsmith $
 */
abstract class BaseRefereeFormFilter extends BaseFormFilterDoctrine
{
  public function setup()
  {
    $this->setWidgets(array(
      'level1_course_date'      => new sfWidgetFormFilterDate(array('from_date' => new sfWidgetFormDate(), 'to_date' => new sfWidgetFormDate())),
      'level1_test_result'      => new sfWidgetFormFilterInput(),
      'level1_valid_date'       => new sfWidgetFormFilterDate(array('from_date' => new sfWidgetFormDate(), 'to_date' => new sfWidgetFormDate())),
      'level2_course_date'      => new sfWidgetFormFilterDate(array('from_date' => new sfWidgetFormDate(), 'to_date' => new sfWidgetFormDate())),
      'level2_test_result'      => new sfWidgetFormFilterInput(),
      'level2_valid_date'       => new sfWidgetFormFilterDate(array('from_date' => new sfWidgetFormDate(), 'to_date' => new sfWidgetFormDate())),
      'level2_valid_tournament' => new sfWidgetFormFilterInput(),
      'level3_course_date'      => new sfWidgetFormFilterDate(array('from_date' => new sfWidgetFormDate(), 'to_date' => new sfWidgetFormDate())),
      'level3_test_result'      => new sfWidgetFormFilterInput(),
      'level3_valid_date'       => new sfWidgetFormFilterDate(array('from_date' => new sfWidgetFormDate(), 'to_date' => new sfWidgetFormDate())),
      'level4_valid_date'       => new sfWidgetFormFilterDate(array('from_date' => new sfWidgetFormDate(), 'to_date' => new sfWidgetFormDate())),
      'level5_valid_date'       => new sfWidgetFormFilterDate(array('from_date' => new sfWidgetFormDate(), 'to_date' => new sfWidgetFormDate())),
      'level1_course'           => new sfWidgetFormDoctrineChoice(array('model' => $this->getRelatedModelName('Course'), 'add_empty' => true)),
      'level2_course'           => new sfWidgetFormDoctrineChoice(array('model' => $this->getRelatedModelName('Course_3'), 'add_empty' => true)),
      'level3_course'           => new sfWidgetFormDoctrineChoice(array('model' => $this->getRelatedModelName('Course_4'), 'add_empty' => true)),
      'level1_teacher'          => new sfWidgetFormFilterInput(),
      'level2_teacher'          => new sfWidgetFormFilterInput(),
      'level3_teacher'          => new sfWidgetFormFilterInput(),
    ));

    $this->setValidators(array(
      'level1_course_date'      => new sfValidatorDateRange(array('required' => false, 'from_date' => new sfValidatorDate(array('required' => false)), 'to_date' => new sfValidatorDateTime(array('required' => false)))),
      'level1_test_result'      => new sfValidatorSchemaFilter('text', new sfValidatorInteger(array('required' => false))),
      'level1_valid_date'       => new sfValidatorDateRange(array('required' => false, 'from_date' => new sfValidatorDate(array('required' => false)), 'to_date' => new sfValidatorDateTime(array('required' => false)))),
      'level2_course_date'      => new sfValidatorDateRange(array('required' => false, 'from_date' => new sfValidatorDate(array('required' => false)), 'to_date' => new sfValidatorDateTime(array('required' => false)))),
      'level2_test_result'      => new sfValidatorSchemaFilter('text', new sfValidatorInteger(array('required' => false))),
      'level2_valid_date'       => new sfValidatorDateRange(array('required' => false, 'from_date' => new sfValidatorDate(array('required' => false)), 'to_date' => new sfValidatorDateTime(array('required' => false)))),
      'level2_valid_tournament' => new sfValidatorSchemaFilter('text', new sfValidatorInteger(array('required' => false))),
      'level3_course_date'      => new sfValidatorDateRange(array('required' => false, 'from_date' => new sfValidatorDate(array('required' => false)), 'to_date' => new sfValidatorDateTime(array('required' => false)))),
      'level3_test_result'      => new sfValidatorSchemaFilter('text', new sfValidatorInteger(array('required' => false))),
      'level3_valid_date'       => new sfValidatorDateRange(array('required' => false, 'from_date' => new sfValidatorDate(array('required' => false)), 'to_date' => new sfValidatorDateTime(array('required' => false)))),
      'level4_valid_date'       => new sfValidatorDateRange(array('required' => false, 'from_date' => new sfValidatorDate(array('required' => false)), 'to_date' => new sfValidatorDateTime(array('required' => false)))),
      'level5_valid_date'       => new sfValidatorDateRange(array('required' => false, 'from_date' => new sfValidatorDate(array('required' => false)), 'to_date' => new sfValidatorDateTime(array('required' => false)))),
      'level1_course'           => new sfValidatorDoctrineChoice(array('required' => false, 'model' => $this->getRelatedModelName('Course'), 'column' => 'idcourse')),
      'level2_course'           => new sfValidatorDoctrineChoice(array('required' => false, 'model' => $this->getRelatedModelName('Course_3'), 'column' => 'idcourse')),
      'level3_course'           => new sfValidatorDoctrineChoice(array('required' => false, 'model' => $this->getRelatedModelName('Course_4'), 'column' => 'idcourse')),
      'level1_teacher'          => new sfValidatorSchemaFilter('text', new sfValidatorInteger(array('required' => false))),
      'level2_teacher'          => new sfValidatorSchemaFilter('text', new sfValidatorInteger(array('required' => false))),
      'level3_teacher'          => new sfValidatorSchemaFilter('text', new sfValidatorInteger(array('required' => false))),
    ));

    $this->widgetSchema->setNameFormat('referee_filters[%s]');

    $this->errorSchema = new sfValidatorErrorSchema($this->validatorSchema);

    $this->setupInheritance();

    parent::setup();
  }

  public function getModelName()
  {
    return 'Referee';
  }

  public function getFields()
  {
    return array(
      'user'                    => 'Text',
      'level1_course_date'      => 'Date',
      'level1_test_result'      => 'Number',
      'level1_valid_date'       => 'Date',
      'level2_course_date'      => 'Date',
      'level2_test_result'      => 'Number',
      'level2_valid_date'       => 'Date',
      'level2_valid_tournament' => 'Number',
      'level3_course_date'      => 'Date',
      'level3_test_result'      => 'Number',
      'level3_valid_date'       => 'Date',
      'level4_valid_date'       => 'Date',
      'level5_valid_date'       => 'Date',
      'level1_course'           => 'ForeignKey',
      'level2_course'           => 'ForeignKey',
      'level3_course'           => 'ForeignKey',
      'level1_teacher'          => 'Number',
      'level2_teacher'          => 'Number',
      'level3_teacher'          => 'Number',
    );
  }
}
